#include "VGCVirtualGameConsole.h"
#include "CTextEntity.h"
#include "CVector.h"
#include <iostream>

using namespace std;

CTextEntity::CTextEntity(string text, int x, int y):
	CEntity(x, y),
	text(text),
	font(VGCDisplay::openFont("Times New Roman", 16)),
	color(VGCColor(255, 0, 0, 0)) {}

CTextEntity::~CTextEntity() {
	VGCDisplay::closeFont(font);
}

void CTextEntity::setText(string text) {
	this->text = text;
}

string CTextEntity::getText() {
	return this->text;
}

void CTextEntity::setFont(VGCFont font) {
	this->font = font;
}

VGCFont CTextEntity::getFont() {
	return this->font;
}

void CTextEntity::setColor(VGCColor color) {
	this->color = color;
}

VGCColor CTextEntity::getColor() {
	return this->color;
}

void CTextEntity::draw(const double &time) {
	VGCDisplay::renderString(getFont(), getText(), getColor(), getPosition().toVGC(), getAdjustment());
}

void CTextEntity::destroy() {
	VGCDisplay::closeFont(getFont());
}